<!DOCTYPE html>
<html>
<head lang="en">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/>
    <link rel="shortcut icon" href="http://www.pulu.com/weixin/img/smlogo.png" type="image/x-icon">
    <meta name = "format-detection" content="telephone = no" />
    <meta charset="UTF-8">
    <title>用户统计</title>
    <link rel="stylesheet" href="http://www.pulu.com/weixin/css/index2.css"/>
    <style>
        .Cell .tc_image img {
            max-height: 33px;
            max-width: 33px;
        }
        .Cell .tc_inner{
            line-height: 30px;
            border-bottom:1px solid #ECECEC;
            margin:0;
            position: relative;
        }
        .Cell .tc_image a{
            overflow: hidden;
            width:100%;
            height:100%;
            z-index: 1000;
        }
        .friends{
            position: relative;
            overflow: hidden;
            padding:10px;
        }
        .friends>div.imageplace{
            float: left;
        }
        div.imageplace{
            height:60px;
            width: 60px;
            overflow: hidden;
        }
        div.imageplace>a{
            display: block;
            width:100%;
            height:100%;
        }
        div.imageplace img{
            width:100%;
            height:100%;
        }
        div.innerplace{
            margin-left:70px;
        }
        div.innerplace a{
            display: block;
            margin-top:5px;
        }
        #listplace .straddbtn{
            display:inline-block;
            float:right;
            line-height: 26px;
            border:1px solid #41A5ED;
            text-align: center;
            border-radius: 3px;
            color:#41A5ED;
            font-size:12px;
            margin:0 auto;
            cursor:pointer;
            width: 20vw;
            max-width: 72px;
            min-width:47px;
            height:26px;
        }
        .innerplace a{
            font-size:14px;
            color:#999698;
        }
        .innerplace>div>div{
            margin-bottom:1px;
        }
        .innerplace a.tc_text{
            font-size:16px;
            font-weight: bold;
            color:#191919;
            display:inline-block;
        }
        .innerplace a.tc_text+div{display:inline-block;}
        #listplace .straddbtn.clicked{
            border:1px solid #A9A9A9;
            color:#A9A9A9;
        }
        /*修改*/
        .title{
            margin:0 44px;
            height:44px;
            text-align: center;
            line-height: 44px;
            color: #fff;
            font-size: 17px;
        }
        .tc_text{padding-bottom:5px;}
        #nomore{
            display:none;
            color:#888;
            font-size:15px;
            padding:10px;
            text-align:center;
        }
        /*修改2*/
        h2.no_highlight a.question_link{
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-weight: normal;
            font-size:14px;
            color:#747D86;
            padding-right:10px;
        }
        .listtitle>div{
            font-size: 14px;
            font-weight: bold;
            color: #999;
        }
        /*修改3*/
        #listplace .Cell{border-bottom:1px solid #ececec;}

        .usernuminfo{
            height: 44px;
            line-height: 44px;
            text-align: center;
            border-bottom: 1px solid #ececec;
            color: #747D86;
        }
        .usernuminfo>span{
            color:#9BCD04;
        }
    </style>
</head>
<body class=" experiment-lookup_bar-on gating-feed_switcher_bar-on mweb  gating-new_mweb_header_logged_out-off" id="chatpage">
<div class="PageWrapper nonav">
    <div class=" has_toolbar">
        <!-- 头部-->
        <div class="Header ModalHeader">
            <div class="fixed_header">
                <div class="header_main">
                    <div class="title">
                        <span>PULU用户统计</span>
                    </div>
                </div>
            </div>
        </div>
        <!-- 用户数-->
        <div class="usernuminfo">
            昨日新增用户: <span id="lastdayAddCount"></span>&nbsp;&nbsp;&nbsp;最近7天新增: <span id="sevenuserCount"></span>&nbsp;&nbsp;&nbsp;总用户数: <span id="totaluserCount"></span>
        </div>
        <p style="padding:10px;">最近7天注册的人:</p>
        <div id="listplace" class="home_feed" style="display:block;">
            <div class="Section">

            </div>
        </div>
        <div id="nomore">没有更多信息</div>
        <div id="pleasewait1">
            <div class="waitbox">
                <div id="waiting1">加载中...</div>
            </div>
        </div>
    </div>
</div>
<script src="http://www.pulu.com/weixin/js/jquery-1.11.3.min.js"></script>
<script>
    function getDateTimeStamp(dateStr){
        dateStr=dateStr.match(/[0-9\-T\:]+/)[0].replace(/T/g,' ');
        return Date.parse(dateStr.replace(/-/gi,"/"));
    }
    function getDateDiff(dateTimeStamp){
        var minute = 1000 * 60;
        var hour = minute * 60;
        var day = hour * 24;
        var halfamonth = day * 15;
        var month = day * 30;
        var now = new Date().getTime();
        var diffValue = now - dateTimeStamp;
        if(diffValue < 0){ result="刚刚";return;}
        var monthC =diffValue/month;
        var weekC =diffValue/(7*day);
        var dayC =diffValue/day;
        var hourC =diffValue/hour;
        var minC =diffValue/minute;
        if(monthC>=1){result="" + parseInt(monthC) + "月前";}
        else if(weekC>=1){result="" + parseInt(weekC) + "周前";}
        else if(dayC>=1){result=""+ parseInt(dayC) +"天前";}
        else if(hourC>=1){result=""+ parseInt(hourC) +"小时前";}
        else if(minC>=1){result=""+ parseInt(minC) +"分钟前";}
        else result="刚刚";
        return result;
    }
    var currentIndex= 1,pageSize=15;
    function aj(){
        canload=false;
        $.ajax({
            type:"get",
            url:"https://www.pulu.com/webapi/api/PuluUser/GetUserScores",
            datatype:"json",
            success:function(data){
                $("#lastdayAddCount").html(data.Data.lastdayAddCount);
                $("#sevenuserCount").html(data.Data.lastweekAddCount);
                $("#totaluserCount").html(data.Data.totaluserCount);
                if(data.Data.weekAddUserInfos&&data.Data.weekAddUserInfos.length>0){
                    canload=true;
                    var code="";
                    var d=data.Data.weekAddUserInfos;
                    for(var i=0;i<d.length;i++){
                        var userimg;//头像
                        if(d[i].headImg){
                            userimg="<img class='topic_photo_img' src='http://42.62.66.198:8003/"+d[i].headImg+"'/>";
                        }else{
                            userimg="<img class='topic_photo_img' src='img/af8.png'/>"
                        }
                        var tim=getDateDiff(getDateTimeStamp(d[i].ctime));
                        if(!tim){tim="刚刚"};
                        code+="<div class='Cell'> <div class='friends'> <div class='imageplace'> <a>"+userimg+"</a> </div> <div class='innerplace'> <div><div> <a class='tc_text'>"+d[i].nick+"</a></div><a>"+tim+"注册</a></div></div></div>"+"</div>"
                    }
                    $("#listplace ").append(code);
                    $("#nomore").css("display","block");
                    $("#pleasewait1").css("display","none");
                }
                else{
                    $("#nomore").css("display","block");
                    $("#pleasewait1").css("display","none");
                }

            },
            error:function(d){
                console.log(d);
            }
        })
    }
    aj();
</script>
</body>
</html>